package jsyf.oa.web.report;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.system.WechatContactsFacade;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Description:
 * Cteated by yanngbin
 * 2018/3/21 14:17
 */
@Api(value = "微信好友数报表接口", description = "微信好友数报表接口")
@Controller
@RequestMapping("/reportWechatContacts")
public class WechatContactsReportController {
    @Resource
    private WechatContactsFacade wechatContactsFacade;
    @ApiOperation(
            value = "微信好友数汇总",
            notes = "微信好友数汇总",
            httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_VALUE
    )
    @ApiImplicitParam(name = "jsonData",paramType = "String",dataType = "body",
    value = "{}")
    @RequestMapping(value = "/getWechatContactsTotal.json",method = RequestMethod.POST)
    public void getWechatContactsTotal(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData){
        JSONObject jsonObject = JSON.parseObject(jsonData);
       List<JSONObject> result = wechatContactsFacade.getWechatContactsTotal(jsonObject);
       ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(result));
    }

}
